package com.ftg.learn.mapper;

import java.util.List;

import org.apache.ibatis.annotations.*;

import com.ftg.learn.pojo.Dept;

@Mapper
public interface DeptMapper {

    @Select("select * from dept")//10
    List<Dept> showall();

    @Select("select count(*) from dept where deptno = ifnull(#{arg0},deptno) or dname = ifnull(#{arg0},deptno)")//11
    int getCount(String deptno);

    @Delete("delete from dept where deptno = #{deptno}")
    int deleteDeptno(int deptno);

    @Update("update dept set dname = #{dname},loc=#{loc} where deptno = #{deptno}")
    int update(Dept dept);

    @Insert("insert into dept (deptno,dname,loc) values(#{deptno},#{dname},#{loc})")
    int add(Dept dept);

}
